home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 039a / mawk10.zip / SCAN.H < prev    next >
C/C++ Source or Header  |  1991-10-05  |  3KB  |  120 lines

  1.  
  2. /********************************************
  3. scan.h
  4. copyright 1991, Michael D. Brennan
  5.  
  6. This is a source file for mawk, an implementation of
  7. the AWK programming language.
  8.  
  9. Mawk is distributed without warranty under the terms of
  10. the GNU General Public License, version 2, 1991.
  11. ********************************************/
  12.  
  13.  
  14. /* $Log:    scan.h,v $
  15.  * Revision 3.4.1.1  91/09/14  17:24:16  brennan
  16.  * VERSION 1.0
  17.  * 
  18.  * Revision 3.4  91/08/13  06:52:08  brennan
  19.  * VERSION .9994
  20.  * 
  21.  * Revision 3.3  91/06/28  04:17:35  brennan
  22.  * VERSION 0.999
  23.  * 
  24.  * Revision 3.2  91/06/10  15:59:36  brennan
  25.  * changes for V7
  26.  * 
  27.  * Revision 3.1  91/06/07  10:28:19  brennan
  28.  * VERSION 0.995
  29.  * 
  30.  * Revision 2.2  91/04/09  12:39:31  brennan
  31.  * added static to funct decls to satisfy STARDENT compiler
  32.  * 
  33.  * Revision 2.1  91/04/08  08:23:54  brennan
  34.  * VERSION 0.97
  35.  * 
  36. */
  37.  
  38.  
  39. /* scan.h  */
  40.  
  41. #ifndef  SCAN_H_INCLUDED
  42. #define  SCAN_H_INCLUDED   1
  43.  
  44. #include <stdio.h>
  45.  
  46. #ifndef   MAKESCAN
  47. #include  "symtype.h"
  48. #include  "parse.h"
  49. #endif
  50.  
  51.  
  52. extern  char scan_code[256] ;
  53.  
  54. /*  the scan codes to compactify the main switch */
  55.  
  56. #define  SC_SPACE               1
  57. #define  SC_NL                  2
  58. #define  SC_SEMI_COLON          3
  59. #define  SC_FAKE_SEMI_COLON     4
  60. #define  SC_LBRACE              5
  61. #define  SC_RBRACE              6
  62. #define  SC_QMARK               7
  63. #define  SC_COLON               8
  64. #define  SC_OR                  9
  65. #define  SC_AND                10
  66. #define  SC_PLUS               11
  67. #define  SC_MINUS              12
  68. #define  SC_MUL                13
  69. #define  SC_DIV                14
  70. #define  SC_MOD                15
  71. #define  SC_POW                16
  72. #define  SC_LPAREN             17
  73. #define  SC_RPAREN             18
  74. #define  SC_LBOX               19
  75. #define  SC_RBOX               20
  76. #define  SC_IDCHAR             21
  77. #define  SC_DIGIT              22
  78. #define  SC_DQUOTE             23
  79. #define  SC_ESCAPE             24
  80. #define  SC_COMMENT            25
  81. #define  SC_EQUAL              26
  82. #define  SC_NOT                27
  83. #define  SC_LT                 28
  84. #define  SC_GT                 29
  85. #define  SC_COMMA              30
  86. #define  SC_DOT                31
  87. #define  SC_MATCH              32
  88. #define  SC_DOLLAR             33
  89. #define  SC_UNEXPECTED         34
  90.  
  91. #ifndef  MAKESCAN
  92.  
  93. /* global functions in scan.c */
  94.  
  95. void  PROTO(scan_init, (int, char *) ) ;
  96. void  PROTO(scan_cleanup, (void) ) ;
  97. void  PROTO(eat_nl, (void) ) ;
  98. int   PROTO(yylex, (void) ) ;
  99.  
  100.  
  101. extern  YYSTYPE  yylval ;
  102.  
  103. #define  ct_ret(x)  return current_token = (x)
  104.  
  105. #define  next() (*buffp ? *buffp++ : slow_next())
  106. #define  un_next()  buffp--
  107.  
  108. #define  ifnext(c,x,y) (next()==(c)?(x):(un_next(),(int)(y)))
  109.  
  110. #define  test1_ret(c,x,d)  if ( next() == (c) ) ct_ret(x) ;\
  111.                            else { un_next() ; ct_ret(d) ; }
  112.  
  113. #define  test2_ret(c1,x1,c2,x2,d)   switch( next() )\
  114.                                    { case c1: ct_ret(x1) ;\
  115.                                      case c2: ct_ret(x2) ;\
  116.                                      default: un_next() ;\
  117.                                               ct_ret(d) ; }
  118. #endif  /* ! MAKESCAN  */
  119. #endif
  120.